package main

import (
	"cqsx/aixin"
	"cqsx/bmi"
	"cqsx/classmates"
	"cqsx/containners"
	"cqsx/denglu"
	"cqsx/getmoney"
	"cqsx/lvyou"
	"cqsx/lvyoudi"
	"cqsx/shuxue"
	"cqsx/student"
	"cqsx/xiugai"
	"cqsx/xuefei"
	"fmt"
	"net/http"
)

func init() {
	fmt.Println("版权归梁铮凌所有")
}
func main() {

	//		email.SendEmail([]string{"3301037936@qq.com"}, "玩", "玩半天")
	//			return
	//	登录不成功，就停留一分钟让用户知道原因
	for i := 0; i < 3; i++ {

		if classmates.Login() {
			goto amhere
		} else {

			fmt.Println("登录第d%次", i+1)
			if i == 2 {
				fmt.Println("您已尝试3次，失败，为了安全强制退出")
				return
			}
		}
	}
amhere:
	for {
		var comand string
		fmt.Println("请输入")
		fmt.Println("目前支持bmi,add,jianfa,chengfa,array,slice,luquxian,exit")
		fmt.Scanln(&comand)
		switch comand {
		case "bmi":
			bmi.Bmi()
		case "denglu":
			denglu.Denglu()
		case "save":
			student.SaveStudentRecords()
		case "dpy":
			aixin.Aixin()
		case "add":
			shuxue.Add()
		case "jianfa":
			shuxue.Jianfa()
		case "chengfa":
			shuxue.Chengfa()
		case "xuefei":
			xuefei.XuefeiDe()
		case "oob":
			student.OOBDemo()
		case "array":
			containners.JiaoFenZiQian()
		case "slice":
			containners.InserStudents()
		case "luquxian":
			containners.Queryluquxian()
		case "passwd":
			classmates.Resetpswd()
		case "tongji":
			containners.Tongji()
		case "api":
			fmt.Println("服务器启动")
			http.HandleFunc("/api/login", getmoney.DpyYmjAPI)
			http.HandleFunc("/api/bmi", bmi.BmiAPI)
			http.HandleFunc("8888", nil)
		case "jd":
			lvyoudi.UseCX()
		case "kaoqin":
			classmates.Findtop10()
		case "dbd":
			classmates.DBDemo()
		case "qq":
			xiugai.Xiugaiqq()
		case "haoma":
			xiugai.Xiugaihaoma()
		case "jiafen":
			classmates.Jiafen()
		case "ymj":
			aixin.Get_love()
		case "zhuanzhang":
			student.ZhuanZhang()
		case "exit":
			break amhere
		}

	}
}
func Xiaofei() {

	var xiaofei float32
	fmt.Println("请输入你一天的消费（单位：元）")
	fmt.Scanln(&xiaofei)
	var shijian int
	fmt.Println("请输入所用时间（单位：天）")
	fmt.Scanln(&shijian)

	zongxiaofei, shifoukaixin := lvyou.Lvyou(xiaofei, shijian)
	fmt.Println("总消费是：", zongxiaofei, "是否开心", shifoukaixin)
	switch {
	case zongxiaofei > 200 && zongxiaofei <= 600:
		fmt.Println("消费较低")
	case zongxiaofei > 600 && zongxiaofei <= 1000:
		fmt.Println("普通消费")
	case zongxiaofei > 1000:
		fmt.Println("高消费")
	default:
		fmt.Println("下次一定去")
	}
	if shifoukaixin {
		fmt.Println("晚上庆祝")
	} else {
		fmt.Println("下次节约")
	}
}
